using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BLL;
using DTO;

namespace QLSV
{
    public partial class ThemMonhoc : Form
    {
        MONHOC mh = new MONHOC();
        MonhocDAL mhdal = new MonhocDAL();
        public ThemMonhoc()
        {
            InitializeComponent();
            lblThongbao.Text = "Nhap ma cua mon hoc can them , roi nhap nut Them";
            btnThem.Enabled = true;
           
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            try
            {
                bool mh = mhdal.InsertMONHOC(Convert.ToByte(txtMamon.Text), txtTenmon.Text);
                if (mh)
                {
                    lblThongbao.Text = "Them thanh cong";
                    btnThem.Enabled = false;
                    btnUndo.Enabled = true;

                }
                else
                    lblThongbao.Text = "Them that bai";
            }
            catch
            {
                lblThongbao.Text = "Them that bai";
            }
        }

        private void btnUndo_Click(object sender, EventArgs e)
        {
            lblThongbao.Text = "Nhap ma cua mon hoc can thay doi thong tin, roi nhap nut Them";
            txtTenmon.Text = "";
            txtMamon.Text = "";
            btnThem.Enabled = true;
            btnUndo.Enabled = false;
        }

    }
}